﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace cmdLineParserModule.HelperClasses
{
    /// <summary>
    /// Token representing one argument from command line
    /// </summary>
    internal class cmdLineToken
    {
        // text without changes
        public string originalText;

        // text without prefix
        public string unprefixedText;

        // token is choice?
        public bool isChoice;

        // token is used?
        public bool isUsed;

        /// <summary>
        /// Creates Token from string with additional info
        /// </summary>
        /// <param name="isAfterSeparator">True if Token was found after separator</param>
        /// <param name="arg">String value from command line</param>
        public cmdLineToken(bool isAfterSeparator, string arg)
        {
            isChoice =
                (!isAfterSeparator
             && (arg.StartsWith(ParserConsts.CHOICESTARTSHORT) || arg.StartsWith(ParserConsts.CHOICESTARTLONG))
             && ChoiceTextManager.fitsChoicePattern(arg));

            isUsed = false;
            originalText = arg;
            unprefixedText = ChoiceTextManager.removeChoicePrefix(arg);
        }
    }
}
